package com.faw.fengyue.rfid.core;

import android.content.Context;
import android.os.Build;
import android.webkit.JavascriptInterface;

import com.faw.fengyue.rfid.utils.APKVersionCodeUtils;
import com.xuexiang.xutil.tip.ToastUtils;

public class JsInterface {

    private Context context;

    public JsInterface(Context context) {
        this.context = context;
    }

    @JavascriptInterface
    public String getDeviceId(){
        if (context == null) {
            return "";
        }
        return DeviceIdentifier.getUUID();
    }

    /**
     * 获取当前本地apk的版本
     *
     * @return
     */
    @JavascriptInterface
    public int getVersionCode() {
        return APKVersionCodeUtils.getVersionCode(context);
    }

    /**
     * 获取版本号名称
     *
     * @return
     */
    @JavascriptInterface
    public String getVerName() {
        return APKVersionCodeUtils.getVerName(context);
    }
}
